package com.novax.ex.activity.provider.controller;

import com.novax.ex.activity.provider.api.InternationalApi;
import jodd.util.StringUtil;

import jakarta.annotation.Resource;

/**
 * Description: 活动基础服务
 *
 * @author shaw
 * @date 12/5/22 17:20
 */
public class BaseActivityController {

    @Resource
    private InternationalApi internationalApi;

    /**
     * 获取国际化翻译
     *
     * @param language language
     * @param code     国际化编码
     * @return string 国际化
     */
    protected String getInternational(String language, String code) {
        String content = internationalApi.getInternational(code, language).getData();
        content = null == content || content.length() == 0?code:content;
        return content;
    }

    /**
     * @Description: 币种转小写
     * @Author: ChenXi
     * @Date:  2022/12/16 16:58
     * @Param: [currency]
     * @return: java.lang.String
     **/
    protected String currencyToLowerCase(String currency){
        if(StringUtil.isBlank(currency)){
            return "";
        } else {
            return currency.toLowerCase();
        }
    }
}
